package com.ruoyi.system.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.SchoolRoleApproveLog;
import com.ruoyi.system.service.ISchoolRoleApproveLogService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 学校认证记录表增删改查Controller
 * 
 * @author hyb
 * @date 2023-03-04
 */
@RestController
@RequestMapping("/schoolApprove")
public class SchoolRoleApproveLogController extends BaseController
{
    @Autowired
    private ISchoolRoleApproveLogService schoolRoleApproveLogService;




    /**
     * 查询学校认证记录表增删改查列表
     */
    @RequiresPermissions("schoolApprove:schoolApprove:list")
    @GetMapping("/list")
    public TableDataInfo list(SchoolRoleApproveLog schoolRoleApproveLog)
    {
        startPage();
        List<SchoolRoleApproveLog> list = schoolRoleApproveLogService.selectSchoolRoleApproveLogList(schoolRoleApproveLog);
        return getDataTable(list);
    }

    /**
     * 导出学校认证记录表增删改查列表
     */
    @RequiresPermissions("schoolApprove:schoolApprove:export")
    @Log(title = "学校认证记录表增删改查", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SchoolRoleApproveLog schoolRoleApproveLog)
    {
        List<SchoolRoleApproveLog> list = schoolRoleApproveLogService.selectSchoolRoleApproveLogList(schoolRoleApproveLog);
        ExcelUtil<SchoolRoleApproveLog> util = new ExcelUtil<SchoolRoleApproveLog>(SchoolRoleApproveLog.class);
        util.exportExcel(response, list, "学校认证记录表增删改查数据");
    }

    /**
     * 获取学校认证记录表增删改查详细信息
     */
    @RequiresPermissions("schoolApprove:schoolApprove:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(schoolRoleApproveLogService.selectSchoolRoleApproveLogById(id));
    }

    /**
     * 新增学校认证记录表增删改查
     */
    @RequiresPermissions("schoolApprove:schoolApprove:add")
    @Log(title = "学校认证记录表增删改查", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SchoolRoleApproveLog schoolRoleApproveLog)
    {
        return toAjax(schoolRoleApproveLogService.insertSchoolRoleApproveLog(schoolRoleApproveLog));
    }

    /**
     * 修改学校认证记录表增删改查
     */
    @RequiresPermissions("schoolApprove:schoolApprove:edit")
    @Log(title = "学校认证记录表增删改查", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SchoolRoleApproveLog schoolRoleApproveLog)
    {
        return toAjax(schoolRoleApproveLogService.updateSchoolRoleApproveLog(schoolRoleApproveLog));
    }

    /**
     * 删除学校认证记录表增删改查
     */
    @RequiresPermissions("schoolApprove:schoolApprove:remove")
    @Log(title = "学校认证记录表增删改查", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(schoolRoleApproveLogService.deleteSchoolRoleApproveLogByIds(ids));
    }
}
